// VideoInputPin.h: interface for the CVideoInputPin class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_VIDEOINPUTPIN_H__DEFD8A8E_DC96_43AF_84A2_81E62D0F8D92__INCLUDED_)
#define AFX_VIDEOINPUTPIN_H__DEFD8A8E_DC96_43AF_84A2_81E62D0F8D92__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif
typedef struct _MSFilter MSFilter;
typedef struct _MSTicker MSTicker;

class CVideoInputPin : public CBaseInputPin  
{
	friend class CJRtpSendVideo;
public:
	CVideoInputPin(CJRtpSendVideo *pFilter, HRESULT *phr, LPCWSTR pPinName);
	virtual ~CVideoInputPin();

	DECLARE_IUNKNOWN


	HRESULT
        GetMediaType (
            IN  int             iPos,
            OUT CMediaType *    pmt
            ) ;
	
	/*
     * default handling for EndFlush - call at end of your implementation
     * - before calling this, ensure that there is no queued data and no thread
     * pushing any more without a further receive, then call downstream,
     * then call this method to clear the m_bFlushing flag and re-enable
     * receives
	 */
   
	/* do something with this media sample */
    STDMETHODIMP Receive(IMediaSample *pSample);
	HRESULT CheckMediaType(const CMediaType *pMediaType);
	void sendSample(IMediaSample *pSample);

	long mtu;
	
private:
	BOOL		m_bInitJrtp;
    CJRtpSendVideo*	m_pJRtpSendVideo;
	int m_nPacketSquence;
	void sendDate(mblk_t *packet,uint32_t timestamp);
    void rfc4629_generate_follow_on_packets(mblk_t *frame, uint32_t timestamp, uint8_t *psc, uint8_t *end, bool_t last_packet);

    //AVCodecContext av_context;
	//mblk_t *comp_buf;

	void init(RtpProfile *profile, int payload);
	
	
	MSFilter *pixconv;
	MSFilter *pixconv1;
	MSFilter *sizeconv;
	MSFilter *encoder;
	MSFilter *rtpsend;
	 MSTicker *ticker ;
};

#endif // !defined(AFX_VIDEOINPUTPIN_H__DEFD8A8E_DC96_43AF_84A2_81E62D0F8D92__INCLUDED_)
